<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>春节活动</title>
    <script src="{$oss}/active/newyear/js/rem.js"></script>
    <link rel="stylesheet" href="{$oss}/active/year_activ/2021/css/style.css?v=2">
<!--        <link rel="stylesheet" href="/static/sixyear/css/style.css?v=7">-->
    <!--    <meta name="description" content="{$descript}">-->
    <script src="https://static.mlinks.cc/scripts/dist/mlink.min.js"></script>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
</head>
<body>
<div class="content">
    <div class="img-item">
        <img src="{$oss}/active/year_activ/2021/img/h1.png?v=1" alt="">
        <div class="des1">除夕到初六，惊喜不断</div>
        <div class="des2">每天8点开始，优惠券，免费券等你来拿</div>
    </div>
    {if $record}
    <div class="tip-box">
        <div class="tip-content-box">
            {foreach name='record' item='v'}
            <div class="tip-item">
                <span>{$v.nickname}抢到"{$v.cname}"</span>
            </div>
            {/foreach}
            <div class="tip-item">
                <span>{$record[0]['nickname']}抢到"{$record[0]['cname']}"</span>
            </div>
        </div>
    </div>
    {/if}
    <!--    内容-->
    <div class="item-box">
        <div class="item-box-style">
            <div style="width: 7.5rem;height: 1.9rem;overflow: hidden;margin-bottom: 0.1rem">
                <div class="item-sel-box-x" style="width: 7.1rem;height: 2rem;margin: 0 auto;overflow-y: auto">
                    <div class="item-sel-box">
                        <div class="item-sel-box-item{$data[11]['status']==3?'1':''}">
                            <div class="sel-item item11-status{$data[11]['status']==3?'1':'2'} {$index==11?'show':''}" data-index="11"
                                 style="margin-left: 0"></div>
                        </div>
                        <div class="item-sel-box-item{$data[12]['status']==3?'1':''}">
                            <div class="sel-item item12-status{$data[12]['status']==3?'1':'2'} {$index==12?'show':''}"
                                 data-index="12"></div>
                        </div>
                        <div class="item-sel-box-item{$data[13]['status']==3?'1':''}">
                            <div class="sel-item item13-status{$data[13]['status']==3?'1':'2'} {$index==13?'show':''}"
                                 data-index="13"></div>
                        </div>
                        <div class="item-sel-box-item{$data[14]['status']==3?'1':''}">
                            <div class="sel-item item14-status{$data[14]['status']==3?'1':'2'} {$index==14?'show':''}"
                                 data-index="14"></div>
                        </div>
                        <div class="item-sel-box-item{$data[15]['status']==3?'1':''}">
                            <div class="sel-item item15-status{$data[15]['status']==3?'1':'2'} {$index==15?'show':''}"
                                 data-index="15"></div>
                        </div>
                        <div class="item-sel-box-item{$data[16]['status']==3?'1':''}">
                            <div class="sel-item item16-status{$data[16]['status']==3?'1':'2'} {$index==16?'show':''}"
                                 data-index="16"></div>
                        </div>
                        <div class="item-sel-box-item{$data[17]['status']==3?'1':''}">
                            <div class="sel-item item17-status{$data[17]['status']==3?'1':'2'} {$index==17?'show':''}"
                                 data-index="17"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content-box">
                <div class="content-item  {$index==11?'show':''}" data-index="11" data-dt="11">
                    <div class="good-box">
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">还剩<span>{$data[11]['a1_num']}</span>份</p>
                                <p class="name">一生报告<span>8折</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ1-s{$data[11]['b1_status']}  a1 {$index==11?'index-btn':''}"
                                   data-status="{$data[11]['b1_status']}" data-num="{$data[11]['num1']}"
                                   data-link="report_index?need_auth=1"
                                   onclick="getCoupon(this,1)" href="javascript:;">{$data[11]['b1_name']}</a>
                            </div>
                        </div>
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">仅{$data[11]['a2_num']}个名额</p>
                                <p class="name">一生报告<span>免费</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ2-s{$data[11]['b2_status']}  a2 {$index==11?'index-btn':''}"
                                   data-status="{$data[11]['b2_status']}" data-link="report_index?need_auth=1"
                                   onclick="getCoupon(this,2)" href="javascript:;">{$data[11]['b2_name']}</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-item  {$index==12?'show':''}" data-index="12" data-dt="12">
                    <div class="good-box">
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">还剩<span>{$data[12]['a1_num']}</span>份</p>
                                <p class="name">年度运势<span>8折</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ1-s{$data[12]['b1_status']}  a1 {$index==12?'index-btn':''}"
                                   data-status="{$data[12]['b1_status']}" data-num="{$data[12]['num1']}"
                                   data-link="fortune_for_year?need_auth=1"
                                   onclick="getCoupon(this,1)" href="javascript:;">{$data[12]['b1_name']}</a>
                            </div>
                        </div>
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">仅{$data[12]['a2_num']}个名额</p>
                                <p class="name">年度运势<span>免费</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ2-s{$data[12]['b2_status']}  a2 {$index==12?'index-btn':''}"
                                   data-status="{$data[12]['b2_status']}" data-link="fortune_for_year?need_auth=1"
                                   onclick="getCoupon(this,2)" href="javascript:;">{$data[12]['b2_name']}</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-item  {$index==13?'show':''}" data-index="13" data-dt="13">
                    <div class="good-box">
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">还剩<span>{$data[13]['a1_num']}</span>份</p>
                                <p class="name">月运解锁<span>8折</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ1-s{$data[13]['b1_status']}  a1 {$index==13?'index-btn':''}"
                                   data-status="{$data[13]['b1_status']}" data-num="{$data[13]['num1']}"
                                   data-link="fortune_for_month?need_auth=1"
                                   onclick="getCoupon(this,1)" href="javascript:;">{$data[13]['b1_name']}</a>
                            </div>
                        </div>
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">仅{$data[13]['a2_num']}个名额</p>
                                <p class="name">单月运势<span>免费</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ2-s{$data[13]['b2_status']}  a2 {$index==13?'index-btn':''}"
                                   data-status="{$data[13]['b2_status']}" data-link="fortune_for_month?need_auth=1"
                                   onclick="getCoupon(this,2)" href="javascript:;">{$data[13]['b2_name']}</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-item  {$index==14?'show':''}" data-index="14" data-dt="14">
                    <div class="good-box">
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">还剩<span>{$data[14]['a1_num']}</span>份</p>
                                <p class="name">合盘报告<span>8折</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ1-s{$data[14]['b1_status']}  a1 {$index==14?'index-btn':''}"
                                   data-status="{$data[14]['b1_status']}" data-num="{$data[14]['num1']}"
                                   data-link="synastry_report_detail?rid1=0&rid2=0&srid=1&need_auth=1"
                                   onclick="getCoupon(this,1)" href="javascript:;">{$data[14]['b1_name']}</a>
                            </div>
                        </div>
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">仅{$data[14]['a2_num']}个名额</p>
                                <p class="name">合盘报告<span>免费</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ2-s{$data[14]['b2_status']}  a2 {$index==14?'index-btn':''}"
                                   data-status="{$data[14]['b2_status']}"
                                   data-link="synastry_report_detail?rid1=0&rid2=0&srid=1&need_auth=1"
                                   onclick="getCoupon(this,2)" href="javascript:;">{$data[14]['b2_name']}</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-item  {$index==15?'show':''}" data-index="15" data-dt="15">
                    <div class="good-box">
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">还剩<span>{$data[15]['a1_num']}</span>份</p>
                                <p class="name">日运全年<span>8折</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ1-s{$data[15]['b1_status']}  a1 {$index==15?'index-btn':''}"
                                   data-status="{$data[15]['b1_status']}" data-num="{$data[15]['num1']}" data-link="day?need_auth=1"
                                   onclick="getCoupon(this,1)" href="javascript:;">{$data[15]['b1_name']}</a>
                            </div>
                        </div>
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">仅{$data[15]['a2_num']}个名额</p>
                                <p class="name">日运全年<span>免费</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ2-s{$data[15]['b2_status']}  a2 {$index==15?'index-btn':''}"
                                   data-status="{$data[15]['b2_status']}" data-link="day?need_auth=1"
                                   onclick="getCoupon(this,2)" href="javascript:;">{$data[15]['b2_name']}</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-item  {$index==16?'show':''}" data-index="16" data-dt="16">
                    <div class="good-box">
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">还剩<span>{$data[16]['a1_num']}</span>份</p>
                                <p class="name">幸运之城<span>8折</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ1-s{$data[16]['b1_status']}  a1 {$index==16?'index-btn':''}"
                                   data-status="{$data[16]['b1_status']}" data-num="{$data[16]['num1']}" data-link="acg_map?need_auth=1"
                                   onclick="getCoupon(this,1)" href="javascript:;">{$data[16]['b1_name']}</a>
                            </div>
                        </div>
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">仅{$data[16]['a2_num']}个名额</p>
                                <p class="name">幸运之城<span>免费</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ2-s{$data[16]['b2_status']}  a2 {$index==16?'index-btn':''}"
                                   data-status="{$data[16]['b2_status']}" data-link="acg_map?need_auth=1"
                                   onclick="getCoupon(this,2)" href="javascript:;">{$data[16]['b2_name']}</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-item  {$index==17?'show':''}" data-index="17" data-dt="17">
                    <div class="good-box">
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">还剩<span>{$data[17]['a1_num']}</span>份</p>
                                <p class="name">会员解锁<span>8折</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ1-s{$data[17]['b1_status']}  a1 {$index==17?'index-btn':''}"
                                   data-status="{$data[17]['b1_status']}" data-num="{$data[17]['num1']}"
                                   data-link="vip_center?from=2&need_auth=2"
                                   onclick="getCoupon(this,1)" href="javascript:;">{$data[17]['b1_name']}</a>
                            </div>
                        </div>
                        <div class="good-item">
                            <div class="good-name">
                                <p class="num">仅{$data[17]['a2_num']}个名额</p>
                                <p class="name">会员解锁<span>免费</span>券</p>
                            </div>
                            <div class="good-button">
                                <a class="activ2-s{$data[17]['b2_status']}  a2 {$index==17?'index-btn':''}"
                                   data-status="{$data[17]['b2_status']}" data-link="vip_center?from=2&need_auth=2"
                                   onclick="getCoupon(this,2)" href="javascript:;">{$data[17]['b2_name']}</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="bottom-box">
                <div class="give-record" onclick="javascript:commonJsToNative('local','discount_coupon_center?need_auth=2');">卡券中心</div>
                <div class="recommend">
                    <img src="{$oss}/active/year_activ/2021/img/ys_report.png"
                         onclick="javascript:commonJsToNative('local','report_index?need_auth=1');" alt="">
                    <img src="{$oss}/active/year_activ/2021/img/ny_report.png"
                         onclick="javascript:commonJsToNative('local','fortune_for_year?time=2021&need_auth=1');" alt="">
                    {if $isUpdate2 != 1}
                    <img src="{$oss}/active/year_activ/2021/img/hp_report.png" onclick="javascript:commonJsToNative('local','synastry_report_detail?rid1=0&rid2=0&srid=1&need_auth=1');" alt="">
                    {else/}
                    <img src="{$oss}/active/year_activ/2021/img/hp_report.png" onclick="javascript:message('版本过低，请升级到最新2.5.2版本领取');" alt="">
                    {/if}
                </div>
            </div>
        </div>
    </div>
    <!--    使用规则标签-->
    <div class="rule-icon">
        <img src="{$oss}/active/year_activ/2021/img/rule-icon.png.png" alt="">
    </div>
    <!--    使用规则详情-->
    <div class="rule-box">
        <div class="cover" style="height: 100Vh"></div>
        <div class="rule-content">
            <div class="rule-info">
                <div class="rile-title-box">
                    <img class="rile-title-icon" src="{$oss}/active/year_activ/2021/img/rule-title-icon.png">
                </div>
                <div class="rule-item">
                    <p class="p-content">1、本活动仅限准了APP用户参与，从除夕至初六，用户每天最多可领取三份优惠券福利，均为限量发售，其中免费券需用户分享后才可以获得抢券权限；领取第二份优惠券需要用户分享后才可领取</p>
                </div>
                <div class="rule-item">
                    <p class="p-content">2、领取到的优惠券，需按照优惠券规则范围内进行使用。</p>
                </div>
                <div class="rule-item">
                    <p class="p-content">3、优惠券领取时间见下表</p>
                </div>
                <img class="ru-if" src="{$oss}/active/year_activ/2021/img/rule-info.png" alt="">
                <div class="rule-item">
                    <p class="p-content">4、优惠券不得拆分，不得转赠或者售卖。</p>
                </div>
                <div class="rule-item">
                    <p class="p-content">5、优惠仅限在有效期内进行使用，逾期作废。</p>
                </div>
                <div class="rule-item">
                    <p class="p-content">6、优惠券不可兑换、不找零、不可兑现，每个订单最多可使用一张优惠券。不能叠加使用。</p>
                </div>
                <div class="rule-item">
                    <p class="p-content">7、在获取和使用优惠券过程中，如果出现违规行为（包含但不限于：作弊领取、恶意盗刷、恶意套现等）准了将有权采取终止违规交易、追回不当利益、废除未使用优惠券等措施。</p>
                </div>
            </div>
            <div class="close-box"><img src="{$oss}/active/newyear/img/close.png" alt=""></div>
        </div>
    </div>
    <div class="msg-box">
        <div class="cover"></div>
        <div class="msg-content">
            <div class="msg-info">
                <div class="msg-title-box"></div>
                <div class="msg-info-content">
                </div>
            </div>
            <div class="close-box"><img src="{$oss}/active/newyear/img/close.png" alt=""></div>
        </div>
    </div>
</div>
<div class="message-box">
    <div class="message"></div>
</div>

<div class="share-box" style="display: none">
    <div class="share-box-shadow"></div>
    <div class="share-choice">
        <div class="title">分享到：</div>
        <div class="share-list">
            <div class="list-item" onclick="toShare(0);">
                <span class="share0"></span>微信好友
            </div>
            <div class="list-item" onclick="toShare(1)">
                <span class="share1"></span>朋友圈
            </div>
            <div class="list-item" onclick="toShare(2);">
                <span class="share2"></span>新浪微博
            </div>
            <div class="list-item" onclick="toShare(3);">
                <span class="share3"></span>QQ好友
            </div>
            <div class="list-item" onclick="toShare(4);">
                <span class="share4"></span>QQ空间
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="{$oss}/active/newyear/js/jquery-v2.1.1.min.js"></script>
<script type="text/javascript">
    {if !$login}
    new Mlink([{
        mlink: 'https://axelkv.mlinks.cc/AesI?target=link&link=' + encodeURIComponent('https://beta-wechat.goddessxzns.com/web/year_activ_six'),//六周年活动
        button: document.querySelector('a.index-btn.a1')
    }, {
        mlink: 'https://axelkv.mlinks.cc/AesI?target=link&link=' + encodeURIComponent('https://beta-wechat.goddessxzns.com/web/year_activ_six'),//六周年活动
        button: document.querySelector('a.index-btn.a2')
    }]);
    {/if}
</script>
<script type="text/javascript">
    var toShare = null;
    var getCoupon = null;
    var commonJsToNative = null;
    var toastHide = null;
    var message = null;
    $(function () {
        var index = {$index};
        var app_type = '{$appType}';
        var thatIndex = null;

        function tipReload(herght, index, num, time) {
            if (num < 1) {
                return;
            }
            if (index > 0) {
                $('.tip-content-box').animate({top: '-' + (herght * index) + 'px'}, 700);
                if (index == num) {
                    setTimeout(function () {
                        $('.tip-content-box').css({top: '0px'});
                    }, 750);
                    index = 0;
                }
            }
            index++;
            setTimeout(function () {
                tipReload(herght, index, num, time)
            }, time)
        }

        tipReload($('.tip-item').height(), 0, {$recordLen}, 5000);
        $('.rule-icon').click(function () {
            $('.rule-box').show();
            $("body").addClass('body-style');
        });
        $('.close-box img').click(function () {
            $('.rule-box').hide();
            $('.msg-box').hide();
            $("body").removeClass('body-style');
        });

        var btnSta1 = {$data[$index]['b1_status']};
        var btnTime1 = {$data[$index]['a1_time']};
        var btnSta2 = {$data[$index]['b2_status']};
        var btnTime2 = {$data[$index]['a2_time']};

        if (btnSta1 == 2) {
            btn1Times(btnTime1)
        }
        if (btnSta2 == 7) {
            setInterval(function () {
                btnTime2--;
            }, 1000)
        }

        function btn1Times(times) {
            if (times <= 0) {
                $('.activ1-s2.index-btn').removeClass('activ1-s2').addClass('activ1-s3').data('status', 3).text('马上抢');
                return;
            }
            var hour = Math.floor(times / 3600);
            var minute = Math.floor((times - hour * 3600) / 60);
            var second = times - hour * 3600 - minute * 60;

            var dates = dataLeftCompleting(hour) + ':' + dataLeftCompleting(minute) + ':' + dataLeftCompleting(second) + '后开抢';
            $('.activ1-s2.index-btn').text(dates);
            times--;
            setTimeout(function () {
                btn1Times(times);
            }, 1000);
        }

        function dataLeftCompleting(value) {
            return parseInt(value) < 10 ? "0" + value.toString() : value;
        }

        function btn2Times(times) {
            if (times <= 0) {
                $('.activ2-s2.index-btn').removeClass('activ2-s2').addClass('activ2-s3').data('status', 3).text('马上抢');
                return;
            }
            var hour = Math.floor(times / 3600);
            var minute = Math.floor((times - hour * 3600) / 60);
            var second = times - hour * 3600 - minute * 60;
            var dates = dataLeftCompleting(hour) + ':' + dataLeftCompleting(minute) + ':' + dataLeftCompleting(second) + '后开抢';
            $('.activ2-s2.index-btn').text(dates);
            times--;
            setTimeout(function () {
                btn2Times(times)
            }, 1000);
        }

        var status = {$login}, aa1 = 1, aa2 = 1, k = 1, isUpdate = {$isUpdate}, isUpdate2 = {$isUpdate2};

        getCoupon = function (obj, type) {
            var that = $(obj);
            var indexStatus = that.data('status'); // 1=>即将开抢（活动未开始）, 2=>即将开抢（活动进行中）, 3=>马上抢, 4=>已过期, 5=>已领取, 6=>已抢空, 7=>分享后可抢,8=>分享再抢一次
            if (indexStatus == 1 || indexStatus == 2 || indexStatus == 4 || indexStatus == 5 || indexStatus == 6) {
                return false;
            }
            if (status != 1) return;
            if (isUpdate == 1) {
                message('您的当前版本较低，需要更新至更高版本才可以参与活动哦~');
                return;
            }
            if (type == 1) { // 普通领取优惠券
                if (indexStatus == 3) {
                    if (aa1 == 2) return;
                    if(that.parents('.content-item').data('dt') == 14  && isUpdate2 == 1){
                        message('版本过低，请升级到最新2.5.2版本领取');
                        return;
                    }
                    aa1 = 2;
                    var index = that.parents('.content-item').data('dt');
                    $.ajax({
                        url: '/api/v23/year_active1?year=2021&dt=' + index,
                        type: 'GET',
                        dataType: 'json',
                        headers: {$headers},
                        success: function (res) {
                            if (res.code == 200) {
                                // var gnum = that.data('num');
                                if (res.data.is_over == 1) { // 第二次领取优惠券
                                    that.removeClass('activ1-s3').addClass('activ1-s5').data('status', 5).text('已领取');
                                } else {
                                    that.removeClass('activ1-s3').addClass('activ1-s8').data('status', 8).text('分享再抢一次');
                                }
                                var cnum = that.parents('.good-item').find('.good-name .num span');
                                cnum.text(cnum.text() - 1);
                                var str1 = '<div class="msg-text">' +
                                    '         <div class="msg-item">恭喜你</div>' +
                                    '         <div class="msg-item">获得' + that.parents('.good-item').find('.name').text() + '！</div>' +
                                    '      </div>' +
                                    '      <div class="msg-btn" onclick="javascript:commonJsToNative(\'local\',\'' + that.data('link') + '\');">去使用</div>' +
                                    '      <div class="msg-tips">已自动发放到卡券中心</div>';
                                toastMessage(str1);
                            } else {
                                var str = '<div class="msg-text">' +
                                    '       <div class="msg-item">' + res.msg + '</div>' +
                                    '    </div>' +
                                    '    <div class="msg-btn" onclick="toastHide()">好的</div>';
                                toastMessage(str);
                            }
                            setTimeout(function () {
                                aa1 = 1;
                            }, 1500);
                            // message(res.msg);
                        }
                    });
                } else {
                    if (k === 3) return;
                    k = 3;
                    // 分享抢
                    $('.share-box').show();
                    thatIndex = that;
                }
            } else {
                if (indexStatus == 3) {
                    if (aa2 == 2) return;
                    if(that.parents('.content-item').data('dt') == 14 && isUpdate2 == 1){
                        message('版本过低；请升级到最新2.5.2版本领取');
                        return;
                    }
                    aa2 = 2;
                    var index = that.parents('.content-item').data('dt');
                    $.ajax({
                        url: '/api/v23/year_active2?year=2021&dt=' + index,
                        type: 'GET',
                        dataType: 'json',
                        headers: {$headers},
                        success: function (res) {
                            if (res.code == 200) {
                                that.removeClass('activ2-s3').addClass('activ2-s5').data('status', 5).text('已领取');

                                var str1 = '<div class="msg-text">' +
                                    '         <div class="msg-item">恭喜你</div>' +
                                    '         <div class="msg-item">获得' + that.parents('.good-item').find('.name').text() + '！</div>' +
                                    '      </div>' +
                                    '      <div class="msg-btn" onclick="javascript:commonJsToNative(\'local\',\'' + that.data('link') + '\');">去使用</div>' +
                                    '      <div class="msg-tips">已自动发放到卡券中心</div>';
                                toastMessage(str1);
                            } else {
                                var str = '<div class="msg-text">' +
                                    '       <div class="msg-item">' + res.msg + '</div>' +
                                    '    </div>' +
                                    '    <div class="msg-btn" onclick="toastHide()">好的</div>';
                                toastMessage(str);
                            }
                            setTimeout(function () {
                                aa2 = 1;
                            }, 1500);
                            // message(res.msg);
                        }
                    });
                } else {
                    if (k === 2) return;
                    k = 2;
                    // 分享抢
                    $('.share-box').show();
                    thatIndex = that;
                }
            }
        }

        toShare = function (shareIndex) {
            commonJsToNativeShare('{$shareTitle}', '{$descript}', '{$domain}/web/year_activ2021/index?zhunleshare=1', shareIndex, 'common_js_to_native', '分享-2021年春节活动')
            if (k === 2) {
                set('share{$uid}_' + index, true);
                setTimeout(function () {
                    k = 1;
                    $('.share-box').hide();
                    if (btnTime2 > 0) {
                        thatIndex.removeClass('activ2-s7').addClass('activ2-s2').data('status', 2);
                        btn2Times(btnTime2);
                    } else {
                        thatIndex.removeClass('activ2-s7').addClass('activ2-s3').data('status', 3).text('马上抢');
                    }
                }, 1500);
            } else {
                set('share{$uid}_1_' + index, true);
                setTimeout(function () {
                    k = 1;
                    $('.share-box').hide();
                    thatIndex.removeClass('activ1-s8').addClass('activ1-s3').data('status', 3).text('马上抢');
                }, 1500);
            }
        }

        setTimeout(function () {
            var isShare = get('share{$uid}_' + index) || false;
            if (isShare) {
                $('.activ2-s7.index-btn').removeClass('activ2-s7').addClass('activ2-s2').data('status', 2);
                btn2Times(btnTime2);
            }
            var isShare1 = get('share{$uid}_1_' + index) || false;
            if (isShare1) {
                $('.activ1-s8.index-btn').removeClass('activ1-s8').addClass('activ1-s3').data('status', 3).text('马上抢');
            }
        }, 200);

        $('.sel-item').click(function () {
            var index = $(this).data('index');
            $('.content-item').removeClass('show');
            $('.content-item[data-index=' + index + ']').addClass('show');
            $(this).addClass('show').parent().siblings().find('.sel-item').removeClass('show');
        });

        if (index == 14) {
            $('.item-sel-box-x').scrollLeft(300);
        }
        if (index == 15) {
            $('.item-sel-box-x').scrollLeft(600);
        }
        if (index > 15) {
            $('.item-sel-box-x').scrollLeft(1100);
        }

        message = function (text) {
            $('.message').text(text);
            $('.message-box').show();
            setTimeout(function () {
                $('.message-box').hide();
            }, 2500);
        }

        function toastMessage(text) {
            $('.msg-box .msg-info-content').html(text);
            $("body").addClass('body-style');
            $('.msg-box').show();
        }

        wx.config({
            debug: false,
            appId: '{$signPackage.appId}',
            timestamp: {$signPackage.timestamp},
            nonceStr: '{$signPackage.nonceStr}',
            signature: '{$signPackage.signature}',
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
        });
        wx.ready(function () {
            wx.onMenuShareAppMessage({
                title: '{$shareTitle}', // 分享标题
                desc: '{$descript}', // 分享描述
                link: '{$signPackage.url}', // 分享链接
                imgUrl: 'https://oss.goddessxzns.com/picture/uploads/logo.png?x-oss-process=style/show', // 分享图标
                type: 'link', // 分享类型,music、video或link，不填默认为link
                dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
            wx.onMenuShareTimeline({
                title: '{$shareTitle}', // 分享标题
                link: '{$signPackage.url}', // 分享链接$signPackage.url
                imgUrl: 'https://oss.goddessxzns.com/picture/uploads/logo.png?x-oss-process=style/show', // 分享图标
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
        });

        function set(key, value) {
            localStorage.setItem(key, value);//转换成json字符串序列
        }

        function get(key)//exp是设置的过期时间
        {
            var val = localStorage.getItem(key);//获取存储的元素
            return val;
        }

        /**
         * 通用跳转
         * @param target string 跳转方式
         * @param link string 跳转地址
         * @param umeng_event_name string 友盟事件名
         * @param umeng_event_label string 友盟事件参数
         */
        commonJsToNative = function (target, link, umeng_event_name, umeng_event_label) {
            console.log('target=' + target + ',link=' + link + ',umeng_event_name=' + umeng_event_name + ',umeng_event_label=' + umeng_event_label)
            umeng_event_name = typeof umeng_event_name === 'undefined' ? '' : umeng_event_name;
            umeng_event_label = typeof umeng_event_label === 'undefined' ? '' : umeng_event_label;
            if (umeng_event_name) {
                umeng_event_label += '-' + link
            }
            if (!target)
                return
            else if (target === 'link') {
                link = domain + link
            }


            switch (app_type) {
                case 'ios':
                    window.webkit.messageHandlers.commonJsToNative.postMessage({
                        'target': target,
                        'link': link,
                        'umeng_event_name': umeng_event_name,
                        'umeng_event_label': umeng_event_label
                    });
                    break;
                case 'android':
                    androidwebview.commonJsToNative(target, link, umeng_event_name, umeng_event_label)
                    break;
                default:
                    console.log('not ios or android')
                    if ('link' === target) {
                        window.location.href = link
                    }
            }
        }

        /**
         * commonJsToNativeShare(title,desc,**url,platform[0：微信；1：微信朋友圈；2：微博；3：qq；4：qq空间]);【注意：banner 跳转的webview 和 服务消息里跳转的webview  要实现的js调用本地分享的方法】
         * @param title
         * @param desc
         * @param url
         * @param platform
         * @param umeng_event_name
         * @param umeng_event_label
         */
        function commonJsToNativeShare(title, desc, url, platform, umeng_event_name, umeng_event_label) {
            switch (app_type) {
                case 'ios':
                    window.webkit.messageHandlers.commonJsToNativeShare.postMessage({
                        'title': title,
                        'desc': desc,
                        'url': url,
                        'platform': platform,
                        'umeng_event_name': umeng_event_name,
                        'umeng_event_label': umeng_event_label
                    });
                    break;
                case 'android':
                    console.log('android')
                    androidwebview.commonJsToNativeShare(title, desc, url, platform, umeng_event_name, umeng_event_label)
                    break;
                default:
                    console.log('not ios or android')
            }
        }

        $('.share-box-shadow').click(function () {
            k = 1;
            $('.share-box').hide();
        });

        toastHide = function () {
            $('.msg-box').hide();
        }
    })
</script>
{include file="../apps/web/view/public/sensors.html" /}
<script>
    var cnzz_s_tag = document.createElement('script');
    cnzz_s_tag.type = 'text/javascript';
    cnzz_s_tag.async = true;
    cnzz_s_tag.charset = 'utf-8';
    cnzz_s_tag.src = 'https://w.cnzz.com/c.php?id=1279233618&async=1';
    var root_s = document.getElementsByTagName('script')[0];
    root_s.parentNode.insertBefore(cnzz_s_tag, root_s);
</script>
</html>
